package org.example.demo21.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.example.demo21.entity.po.UserPO;
import org.example.demo21.mapper.UserMapper;
import org.example.demo21.service.UserService;
import org.springframework.stereotype.Service;

/**
 *
 * @author guocong
 * @since 2024/3/11 15:34
 */
@Slf4j
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserPO> implements UserService {





    @Override
    public UserPO getCache(String username) {
        UserPO a = this.baseMapper.getNoLock(username);
        UserPO b = new LambdaQueryChainWrapper<>(this.baseMapper)
                .eq(UserPO::getAccount, username)
                .eq(UserPO::getIsDeleted, 0)
                .one();

        log.info("info 日志输出，{}", a);
        log.info("info 日志输出，{}", b);
        return b;

    }

    @Override
    public UserPO get(Long id) {
        return this.baseMapper.selectById(id);
    }


}
